package  persentation.presentDepartmentDean;

import javax.swing.ImageIcon;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JLabel;

import java.awt.Color;
import java.awt.Font;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;

import javax.swing.JButton;


public class Title extends JPanel {
	private static final long serialVersionUID = 1L;
	ImageIcon closeImage;
	JButton button;
	ImageIcon exitImageIcon,exitImageIcon2;
	public Title() {
		setSize(1100, 93);
		setBackground(Color.GRAY);
		closeImage=new ImageIcon("Graphics/studentGraphics/title.png");
		setLayout(null);
		setOpaque(false) ;
		
		exitImageIcon=new ImageIcon("Graphics/departmentDean/注销图标.png");
		exitImageIcon2=new ImageIcon("Graphics/departmentDean/高光注销图标.png");
		button = new JButton(exitImageIcon);
		button.setFont(new Font("微软雅黑", Font.PLAIN, 29));
		button.setBounds(954, 0, 60, 60);
		button.setOpaque(false);
		button.setContentAreaFilled(false);
		button.setBorderPainted(false);
		button.setToolTipText("退出");
		add(button);
		button.addMouseListener(new MouseListener() {
			
			@Override
			public void mouseReleased(MouseEvent arg0) {
				
			}
			
			@Override
			public void mousePressed(MouseEvent arg0) {
				
			}
			
			@Override
			public void mouseExited(MouseEvent arg0) {
				button.setBounds(954, 0, 60, 60);
				button.setIcon(exitImageIcon);
			}
			
			@Override
			public void mouseEntered(MouseEvent arg0) {
				button.setBounds(957, 0, 60, 60);
				button.setIcon(exitImageIcon2);
			}
			
			@Override
			public void mouseClicked(MouseEvent arg0) {
				int i=JOptionPane.showConfirmDialog(null,"确认退出系统？","确认",JOptionPane.YES_NO_OPTION);
				if(i==JOptionPane.YES_OPTION){
					System.exit(0);
				}
			}
		});
		
		JLabel label = new JLabel(closeImage);
		label.setBounds(0,0, 1100, 93);
		add(label);
		
		
		

	}
}
